package com.jdrx.sw.sewage.api.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jdrx.platform.commons.rest.beans.vo.ResponseVO;
import com.jdrx.platform.commons.rest.factory.ResponseFactory2;
import com.jdrx.sw.sewage.beans.vo.DeviceFailureAnalysisVO;
import com.jdrx.sw.sewage.beans.vo.DeviceMaintenanceAnalysisVO;
import com.jdrx.sw.sewage.beans.vo.DeviceOverviewAnalysisVO;
import com.jdrx.sw.sewage.beans.vo.DeviceRunTimeAnalysisVO;
import com.jdrx.sw.sewage.beans.vo.DeviceSpareAnalysisVO;
import com.jdrx.sw.sewage.service.DeviceAnalysisService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value = "/api/deviceAnalysis")
@Api(value = "设备分析")
public class DeviceAnalysisApi {
	@Autowired
	private DeviceAnalysisService deviceAnalysisService;
	
	@ApiOperation(value = "设备概览分析")
    @PostMapping(value = "overview")
    public ResponseVO<DeviceOverviewAnalysisVO> overview() {
        return ResponseFactory2.ok(deviceAnalysisService.overview());
    }
	
	@ApiOperation(value = "设备保养分析")
    @PostMapping(value = "maintenanceAnalysis")
    public ResponseVO<DeviceMaintenanceAnalysisVO> maintenanceAnalysis() {
        return ResponseFactory2.ok(deviceAnalysisService.maintenanceAnalysis());
    }
	
	@ApiOperation(value = "设备备件分布情况")
    @PostMapping(value = "spareAnalysis")
    public ResponseVO<List<DeviceSpareAnalysisVO>> spareAnalysis() {
        return ResponseFactory2.ok(deviceAnalysisService.spareAnalysis());
    }
	
	@ApiOperation(value = "设备故障统计TOP10")
    @PostMapping(value = "failureAnalysis")
    public ResponseVO<List<DeviceFailureAnalysisVO>> failureAnalysis() {
        return ResponseFactory2.ok(deviceAnalysisService.failureAnalysis());
    }
	
	@ApiOperation(value = "设备运行时长TOP10")
    @PostMapping(value = "runTimeAnalysis")
    public ResponseVO<List<DeviceRunTimeAnalysisVO>> runTimeAnalysis() {
        return ResponseFactory2.ok(deviceAnalysisService.runTimeAnalysisTop10());
    }
}